package com.power.sifa.approve.model.doc;

import cn.hutool.core.util.ObjectUtil;
import com.power.sifa.approve.model.enumeration.Tp_procmaterial;
import lombok.Data;

/**
 * @ClassName HearAuditStopDoc
 * @Author xiongzw
 * @Date 2023/11/24 14:43
 * @Description 停止执行行政行为通知书
 * @Version: 1.0
 **/
@Data
public class HearAuditStopDoc extends AbstractDoc {

    /**
     * 被申请人
     */
    private String apl_admreview_targetname;
    /**
     * 正文
     */
    private String content;

    /**
     * 抄送
     */
    private String copyto;


    public HearAuditStopDoc() {
        super();
        this.setDocType(Tp_procmaterial.HEAR_STOP);
    }

    public HearAuditStopDoc(String applyid) {
        super(applyid);
        this.setDocType(Tp_procmaterial.HEAR_STOP);
    }

    public HearAuditStopDoc(String applyid, String apl_admreview_targetname, String content, String copyto) {
        super(applyid);
        this.setDocType(Tp_procmaterial.HEAR_STOP);
        this.apl_admreview_targetname = apl_admreview_targetname;
        this.content = content;
        this.copyto = copyto;
    }

    private final static String TEMPLATE = "    {apl_admreview_applyname}对你机关[{behavior}]不服提出的行政复议申请，本府依法已予受理。" +
            "经审查，本府认为：（需要停止执行的事实和理由）根据《中华人民共和国行政复议法》第二十一条的规定，决定自{today}起至作出行政复议决定之日，停止该行政行为的执行。";


    @Override
    public AbstractDoc generateTemplate(String applyid) {
        HearAuditStopDoc template = new HearAuditStopDoc(applyid);
        // 案号
        template.setApl_admre_audit_code(this.getApl_admre_audit_code());
        template.setApl_admreview_targetname(ObjectUtil.isNotNull(this.getAdmreObj()) ? this.getAdmreObj().getTargetname() : "");
        String content = TEMPLATE.replace("{apl_admreview_applyname}", ObjectUtil.isNotNull(this.getAdmreObj()) ?
                this.getAdmreObj().getApplyname() : "" );
        content = content.replace("{behavior}", this.transBehavior());
        content = content.replace("{today}", this.transModelToday(Boolean.FALSE));
        template.setContent(content);
        template.setCopyto(ObjectUtil.isNotNull(this.getAdmreObj()) ? this.getAdmreObj().getApplyname() : "");
        return template;
    }
}
